"""
@name : 用户密码复杂度验证
@author : maxueyan
@projectname: sanchuang
"""

def passwd_judge1(passwd:str,strength_level):
    if len(passwd) < 8:
        remind.append("你的密码长度小于8！密码长度需超过8位")
    else:
        strength_level += 1
    return strength_level

result = [0,0,0,0]
def passwd_judge2(passwd:str):
    for i in passwd:
        if sum(result) >= 3:
            break
        else:
            if i.isupper():
                result[0] = 1
            elif i.islower():
                result[1] = 1
            elif i.isdigit():
                result[2] = 1
            else:
                result[3] = 1
    return result

def passwd_judge3():
    global grade
    grade = 0
    for i in range(len(passwd)):
        if passwd.count(passwd[i:i+3]) >= 2:
            remind.append("你的密码有长度超过或等于3的子串重复！")
            break
        else:
            grade = 1
        return grade

passwd = input("请输入密码：")
strength_level = 2
remind = []
strength_level = passwd_judge1(passwd,strength_level)
grade = passwd_judge3()
if grade == 1:
    grade += 1
result = passwd_judge2(passwd)
if sum(result) < 3:
    cw = ["你的密码需要包括大、小写字母，数字，特殊符号，以上至少三种"]
    print(strength_level,remind+cw)
else:
    strength_level += 1
    print(strength_level,remind)

